package com.yjhb.android.sbz.tool;

import com.yjhb.android.sbz.http.HttpObserver;
import com.yjhb.android.sbz.http.HttpTool;
import com.yjhb.android.sbz.v2.mvp.V2ConventionPresenter;
import com.jojo.android.zxlib.base.mvp.BaseView;

import org.jetbrains.annotations.NotNull;

/**
 * 创建者 zx
 * 创建时间 2021/5/1 0:09
 */
public class URLConfig extends V2ConventionPresenter<BaseView> {

    public static String APPDownloadURL = null;
    private static URLConfig instance;

    private URLConfig(@NotNull BaseView view) {
        super(view);
    }

    public static URLConfig getInstance() {
        if (instance == null) {
            instance = new URLConfig((code, msg) -> {
            });
        }
        return instance;
    }

    public void init() {
        if (model != null) {
            HttpTool.request(model.getShareUrl(), new HttpObserver<String>() {
                @Override
                public void onResult(String data) {
                    APPDownloadURL = data;
                }

                @Override
                public void onError(int code, String msg) {

                }
            });
        }
    }


}
